package com.ease.framework.figures
{
	import mx.containers.Canvas;
	import mx.core.ScrollPolicy;

	public class ContainerFigure extends Canvas implements IContainerFigure
	{
		public function ContainerFigure()
		{
			super();
		}

		public function findFigureAt(stageX:Number, stageY:Number):IFigure
		{
			var i:int;
			//从最上层图形开始遍历
			for (i=this.numChildren - 1; i >= 0; i--)
			{
				if (getChildAt(i) is IFigure)
				{
					var childFigure:IFigure=getChildAt(i) as IFigure;
					if (childFigure.hitTestPoint(stageX, stageY, true))
					{
						return childFigure.findFigureAt(stageX, stageY);
					}
				}
			}
			return this;
		}

	}
}
